;;; Blood --- Bleeding-edge downstream of GNU Guix
;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2016, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2016 2019, 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2023 Jaidyn Ann <jadedctrl@posteo.at>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation, either version 3 of
;;; the License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <https://www.gnu.org/licenses/>.

(define-module (blood packages wm)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages fribidi)
  #:use-module (gnu packages image)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages pkg-config))


(define-public fluxbox
  (package
   (name "fluxbox")
   (version "9d8202f32338a3f08d3fa39057dc5eec5d97be4e")
   (synopsis "Small and fast window manager")
   (source
    (origin
      (method git-fetch)
      (uri (git-reference
            (url "git://git.fluxbox.org/fluxbox.git")
            (commit version)))
      (file-name (git-file-name name version))
      (sha256
       (base32 "0zjfg6bni1wr8r1rh6f2sji3fld5b5xkip7hybcak2sciar44f8s"))))
   (build-system gnu-build-system)
   (arguments
    `(#:make-flags '("CPPFLAGS=-U__TIME__") ;ugly, but for reproducibility
      #:phases
      (modify-phases
       %standard-phases
       (add-after 'install 'install-vim-files
         (lambda* (#:key outputs #:allow-other-keys)
           (let* ((out (assoc-ref outputs "out"))
                  (syntax (string-append out "/share/vim/vimfiles/syntax")))
             (copy-recursively "3rd/vim/vim/syntax" syntax)
             #t)))
       (add-after
        'install 'install-xsession
        (lambda* (#:key outputs #:allow-other-keys)
          (let* ((out (assoc-ref outputs "out"))
                 (xsessions (string-append out "/share/xsessions")))
            (mkdir-p xsessions)
            (call-with-output-file
              (string-append xsessions "/fluxbox.desktop")
              (lambda (port)
                (format port "~
                     [Desktop Entry]~@
                     Name=~a~@
                     Comment=~a~@
                     Exec=~a/bin/startfluxbox~@
                     Type=Application~%" ,name ,synopsis out)))
            #t))))))
   (native-inputs
    (list autoconf automake gnu-gettext libtool pkg-config))
   (inputs
    (list freetype
          fribidi
          imlib2
          libx11
          libxcursor
          libxext
          libxft
          libxinerama
          libxpm
          libxrandr
          libxrender))
   (description "Fluxbox is a window manager.  It is light on resources
and easy to handle yet full of features to make an easy and fast desktop
experience.")
   (home-page "http://fluxbox.org/")
   (license license:expat)))

